package cn.itcast.bos.delivery.service.impl;

import java.util.Date;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.itcast.bos.delivery.dao.WorkBillDao;
import cn.itcast.bos.delivery.service.WorkBillService;
import cn.itcast.bos.domain.base.Courier;
import cn.itcast.bos.domain.delivery.Order;
import cn.itcast.bos.domain.delivery.WorkBill;

@Service
@Transactional
public class WorkBillServiceImpl implements WorkBillService{

	@Autowired
	private WorkBillDao workBillDao;
	@Override
	public void save(Order order, Courier courier) {
		// TODO Auto-generated method stub
		WorkBill workbill=new WorkBill();
		workbill.setAttachbilltimes(0);
		workbill.setBuildtime(new Date());
		workbill.setCourier(courier);
		workbill.setOrder(order);
		workbill.setType("新");
		workbill.setRemark(order.getRemark());
		workbill.setSmsNumber(UUID.randomUUID().toString());
		workBillDao.save(workbill);
	}

}
